package com.cloud.server.system.util;

import com.baomidou.mybatisplus.core.metadata.IPage;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: Dream_xun
 * @date: 2020-08-26 1:07
 * @description: 分页工具类
 */
public class PageUtil {
    /**
     * 封装前端分页表格所需数据
     *
     * @param pageInfo pageInfo
     * @return Map<String, Object>
     */
    public static Map<String, Object> toPage(IPage<?> pageInfo) {
        Map<String, Object> data = new HashMap<>();
        data.put("list", pageInfo.getRecords());
        data.put("total", pageInfo.getTotal());
        return data;
    }
}
